using System;
using System.Collections.Generic;
using OSC.Base;
using Touchality.FoursquareApi;

namespace OSC.Foursquare
{
    public class FoursquareSocialConnector : ISocialConnector
    {
        public string LogonUrl
        {
            get { throw new NotImplementedException(); }
        }

        public string SiteUrl
        {
            get { return "http://www.foursquare.com"; }
        }

        public IPerson Logon(string username, string password, out string connectOut)
        {

            connectOut = "";
            var user = Touchality.FoursquareApi.Foursquare.SignIn(username, password);

            return user != null
                       ? new Person
                             {
                                 FirstName = user.firstname,
                                 LastName = user.lastname,
                                 UserId = user.id,
                                 EmailAddresses = new[] { user.email },
                                 City = user.city,
                                 Gender = user.gender,
                                 FriendStatus = user.friendstatus,
                                 PictureUrl = user.photo,
                                 Phone = user.phone
                             }
                       : null;
        }

        public void Follow(string[] emailAddresses, string displayName)
        {
            throw new NotImplementedException();
        }

        public void Unfollow(string userId)
        {
            throw new NotImplementedException();
        }

        public IEnumerable<IActivity> GetActivities(IPerson person)
        {
            IList<CheckIn> checkins = null;
            Touchality.FoursquareApi.Foursquare.GetCheckIns(e => checkins = e.Result, 0, 0);
            return null;
        }

        public IActivityTemplate GetActivityTemplate()
        {
            throw new NotImplementedException();
        }

        public IEnumerable<IPerson> GetFriends()
        {
            throw new NotImplementedException();
        }
    }
}